const { TreeNode, insertIntoBST } = require('./2. 二叉搜索树的插入实现')

function buildBST(arr) {
    let root = new TreeNode(arr[0])
    for (let i = 1; i < arr.length; i++) {
        insertIntoBST(root, arr[i])
    }
    return root
}

let arr = [14, 7, 18, 3, 9, 16, 19]
console.log(buildBST(arr));

